package com.example.monit.controller;

import com.example.monit.bean.ResourceIndicator;
import com.example.monit.bean.ResponseRust;
import com.example.monit.service.ResourceIndicatorService;
import com.example.monit.vo.ResourceIndicatorTotalVo;
import com.example.monit.vo.ResourceIndicatorVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;


/**
 * 资源指标
 */
@RestController
@RequestMapping("/performances")
public class ResourceIndicatorController {

    @Autowired
    ResourceIndicatorService resourceIndicatorService;

    /**
     * 资源指标插入
     */
    @PostMapping("/resourceindicators")
    public ResponseRust resourceIndicatorLoad(@RequestBody List<ResourceIndicator> resourceIndicator) throws IOException {
        return this.resourceIndicatorService.upLoadResourceIndicator(resourceIndicator);
    }

    /**
     * 资源指标查询接口
     */
    @GetMapping("/resourceindicators")
    public ResponseRust getResourceIndicator(ResourceIndicatorVo resourceIndicatorVo ) throws IOException {
        return this.resourceIndicatorService.queryResourceIndicator(resourceIndicatorVo);
    }

    /**
     * 资源指标统计接口
     */

    @GetMapping("/resourceindicatorstatistics")
    public ResponseRust resourceIndicatorTotal(ResourceIndicatorTotalVo resourceIndicatorTotalVo ) throws IOException {
        return this.resourceIndicatorService.totalinterfaceIndicator(resourceIndicatorTotalVo);
    }

}
